static
arglist_t bcr_args[] = {
- {"index", &rtenum_opt, "Index of route to write (if more the one in source)", NULL, ARGTYPE_INT },
+ {"index", &rtenum_opt, "Index of route to write (if more the one in source)", NULL, ARGTYPE_INT, "1", NULL },
{"name", &rtename_opt, "New name for the route", NULL, ARGTYPE_STRING },
{"radius", &radius_opt, "Radius of our big earth (default 6371000 meters)", NULL, ARGTYPE_FLOAT },
{0, 0, 0, 0, 0}
{"deficon", &option_icon, "Default icon name",
NULL, ARGTYPE_STRING},
{"index", &option_index, "Index of route/track to write (if more the one in source)",
- NULL, ARGTYPE_INT},
+ NULL, ARGTYPE_INT, "1", NULL},
{"radius", &option_radius, "Give points (waypoints/route points) a default radius (proximity)",
- NULL, ARGTYPE_FLOAT},
+ NULL, ARGTYPE_FLOAT, "0", NULL},
{"snlen", &option_snlen, "Length of generated shortnames (default 16)",
- NULL, ARGTYPE_INT},
+ "16", ARGTYPE_INT, "1", NULL},
{0, 0, 0, 0, 0}
};
char **argval;
char *helpstring;
char *defaultvalue;
- long argtype;
+ gbuint32 argtype;
+ char *minvalue; /* minimum value for numeric options */
+ char *maxvalue; /* maximum value for numeric options */
} arglist_t;
typedef enum {
static
arglist_t garmin_args[] = {
{ "snlen", &snlen, "Length of generated shortnames", NULL,
- ARGTYPE_INT },
+ ARGTYPE_INT, "1", NULL },
{ "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames",
NULL, ARGTYPE_BOOL},
{ "deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING },
static arglist_t gdb_args[] = {
{GDB_OPT_CATEGORY, &gdb_opt_category,
- "Default category on output (1..16)", NULL, ARGTYPE_INT},
+ "Default category on output (1..16)", NULL, ARGTYPE_INT, "1", "16"},
{GDB_OPT_VER, &gdb_opt_ver,
- "Version of gdb file to generate (1,2)", "2", ARGTYPE_INT},
+ "Version of gdb file to generate (1,2)", "2", ARGTYPE_INT, "1", "2"},
{GDB_OPT_VIA, &gdb_opt_via,
"Drop route points, if they don't have an aquivalent waypoint (hidden points)", NULL, ARGTYPE_BOOL},
{0, 0, 0, 0, 0}
now = current_time();
- if (snlen)
- short_length = atoi(snlen);
- else
- short_length = 32;
+ short_length = atoi(snlen);
if (suppresswhite) {
setshort_whitespace_ok(mkshort_handle, 0);
static
arglist_t gpx_args[] = {
{ "snlen", &snlen, "Length of generated shortnames",
- NULL, ARGTYPE_INT },
+ "32", ARGTYPE_INT, "1", NULL },
{ "suppresswhite", &suppresswhite,
"Suppress whitespace in generated shortnames",
NULL, ARGTYPE_BOOL },
static arglist_t ignr_args[] =
{
- {"index", &index_opt, "Index of track to write (if more the one in source)", NULL, ARGTYPE_INT },
+ {"index", &index_opt, "Index of track to write (if more the one in source)", NULL, ARGTYPE_INT, "1", NULL },
{0, 0, 0, 0 }
};
static
arglist_t mps_args[] = {
- {"snlen", &snlen, "Length of generated shortnames", NULL, ARGTYPE_INT },
+ {"snlen", &snlen, "Length of generated shortnames", "10", ARGTYPE_INT, "1", NULL },
{ "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames",
NULL, ARGTYPE_BOOL},
{"mpsverout", &mpsverout,
unsigned char copybuf[8192];
- if (snlen)
- short_length = atoi(snlen);
- else
- short_length = 10;
+ short_length = atoi(snlen);
if (mpsmergeout) {
/* need to skip over the merging header and test merge version */
static
arglist_t nmn4_args[] = {
- {"index", &index_opt, "Index of route to write (if more the one in source)", NULL, ARGTYPE_INT },
+ {"index", &index_opt, "Index of route to write (if more the one in source)", NULL, ARGTYPE_INT, "1", NULL },
{0, 0, 0, 0, 0}
};
static arglist_t ovl_args[] = {
{ "col", &govl_col_s, "color index [1-9] for routes",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "1", "9" },
{ "size", &govl_size_s, "size index [101-] for routes",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "101", NULL },
{ "mapname", &govl_mapname, "name of map",
NULL, ARGTYPE_STRING },
{ "zoomfc", &govl_zoomfc_s, "zoom factor of map in %",
{ "dimmfc", &govl_dimmfc_s, "dimmer factor of map in %",
NULL, ARGTYPE_INT },
{ "txtcol", &govl_txtcol_s, "color index [1-9] for waypoint names",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "1", "9" },
{ "txtsize", &govl_txtsize_s, "text size [101-] for waypoint names",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "101", NULL },
{ "font", &govl_font_s, "font index [1-] for waypoint names",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "1", NULL },
{ "txttrans", &govl_txttrans_s, "set text background to transparent",
NULL, ARGTYPE_BOOL },
{ "file", &govl_file_s, "use file of parameters (parameters on command line overwrites file parameters)",
static
arglist_t ozi_args[] = {
{"snlen", &snlenopt, "Max synthesized shortname length",
- NULL, ARGTYPE_INT},
+ "32", ARGTYPE_INT, "1", NULL},
{"snwhite", &snwhiteopt, "Allow whitespace synth. shortnames",
NULL, ARGTYPE_BOOL},
{"snupper", &snupperopt, "UPPERCASE synth. shortnames",
/* set mkshort options from the command line if applicable */
if (global_opts.synthesize_shortnames) {
- if (snlenopt)
- setshort_length(mkshort_handle, atoi(snlenopt));
- else
- setshort_length(mkshort_handle, 32);
+ setshort_length(mkshort_handle, atoi(snlenopt));
if (snwhiteopt)
setshort_whitespace_ok(mkshort_handle, atoi(snwhiteopt));
{
{"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING},
{"deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING},
- {"snlen", &snlen_opt, "Length of generated shortnames", NULL, ARGTYPE_INT },
+ {"snlen", &snlen_opt, "Length of generated shortnames", "10", ARGTYPE_INT, "1", NULL },
{0, 0, 0, 0, 0 }
};
if (global_opts.synthesize_shortnames != 0)
{
- if (snlen_opt != NULL)
- len = atoi(snlen_opt);
- else
- len = 10;
+ len = atoi(snlen_opt);
setshort_length(mkshort_handle, len);
setshort_mustupper(mkshort_handle, 1);
setshort_badchars(mkshort_handle, ",");
{"nosort", &nosort, "Inhibit sort by distance to center.",
NULL, ARGTYPE_BOOL },
{"maxcount", &maxctarg,"Output no more than this number of points",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "1", NULL },
{0, 0, 0, 0, 0}
};
static
arglist_t psit_args[] = {
/* {"snlen", &snlen, "Length of generated shortnames",
- NULL, ARGTYPE_INT }, */
+ NULL, ARGTYPE_INT, "1", NULL }, */
{0, 0, 0, 0, 0}
};
static
arglist_t shp_args[] = {
{"name", &opt_name, "Index of name field in .dbf",
- NULL, ARGTYPE_INT },
+ NULL, ARGTYPE_INT, "0", NULL },
{ 0, 0, 0, 0}
};
static
arglist_t routesimple_args[] = {
{"count", &countopt, "Maximum number of points in route",
- NULL, ARGTYPE_INT | ARGTYPE_REQUIRED},
+ NULL, ARGTYPE_INT | ARGTYPE_REQUIRED, "1", NULL},
{0, 0, 0, 0, 0}
};
{"replace", &opt_replace, "(pop) Replace list (default)",
NULL, ARGTYPE_END_EXCL | ARGTYPE_BOOL},
{"depth", &opt_depth, "(swap) Item to use (default=1)",
- NULL, ARGTYPE_INT},
+ NULL, ARGTYPE_INT, "0", NULL},
{"nowarn", &nowarn, "Suppress cleanup warning", NULL,
ARGTYPE_BOOL | ARGTYPE_HIDDEN},
{0, 0, 0, 0, 0}
static
arglist_t stmwpp_args[] =
{
- {"index", &index_opt, "Index of route/track to write (if more the one in source)", NULL, ARGTYPE_INT },
+ {"index", &index_opt, "Index of route/track to write (if more the one in source)",
+ NULL, ARGTYPE_INT, "1", NULL },
{0, 0, 0, 0, 0}
};
{"margin", &margin, "Margin for map. Degrees or percentage.",
"15%", ARGTYPE_FLOAT},
{"snlen", &snlen, "Max shortname length when used with -s.",
- NULL, ARGTYPE_INT},
+ "10", ARGTYPE_INT, "1", NULL},
{"oldthresh", &oldthresh,
"Days after which points are considered old.",
"14", ARGTYPE_INT},
minlon = 9999.0;
rec_cnt = 0;
- if (snlen)
- short_length = atoi(snlen);
- else
- short_length = 10;
+ short_length = atoi(snlen);
mkshort_whandle = mkshort_new_handle();
if (suppresswhite) {
putchar('\t');
}
+const char *
+name_option(long type)
+{
+ const char *at[] = {
+ "unknown",
+ "integer",
+ "float",
+ "string",
+ "boolean",
+ "file",
+ "outfile"
+ };
+
+ if ((type & ARGTYPE_TYPEMASK) <= 6) {
+ return at[type & ARGTYPE_TYPEMASK];
+ }
+ return at[0];
+}
+
+static void
+disp_v3(vecs_t *vec)
+{
+ arglist_t *ap;
+
+ for (ap = vec->vec->args; ap && ap->argstring; ap++) {
+ if ( !(ap->argtype & ARGTYPE_HIDDEN))
+ printf("option\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
+ vec->name,
+ ap->argstring,
+ ap->helpstring,
+ name_option(ap->argtype),
+ ap->defaultvalue? ap->defaultvalue : "",
+ ap->minvalue? ap->minvalue : "",
+ ap->maxvalue? ap->maxvalue : "");
+ }
+}
+
/*
* Display the available formats in a format that's easy to machine
* parse. Typically invoked by programs like graphical wrappers to
case 0:
case 1:
case 2:
+ case 3:
svp = sort_and_unify_vecs(&vc);
for (i=0;i<vc;i++,vec++) {
vec = svp[i];
printf("%s\t%s\t%s\n", vec->name,
vec->extension? vec->extension : "",
vec->desc);
+ if (version >= 3) {
+ disp_v3(vec);
+ }
}
xfree (svp);
break;
{"style", &styleopt, "Full path to XCSV style file", NULL,
ARGTYPE_FILE | ARGTYPE_REQUIRED },
{"snlen", &snlenopt, "Max synthesized shortname length", NULL,
- ARGTYPE_INT},
+ ARGTYPE_INT, "1", NULL},
{"snwhite", &snwhiteopt, "Allow whitespace synth. shortnames",
NULL, ARGTYPE_BOOL},
{"snupper", &snupperopt, "UPPERCASE synth. shortnames",